package com.zfei.gfb.api.domain;

import java.util.LinkedHashSet;
import java.util.Set;

/**
 * 收件箱名字
 *
 * @author fgh
 */
public class InboxName {

    public static final String DELIMITER = ":"; // 分隔符

    public static String join(String... elements) {
        return String.join(DELIMITER, elements);
    }

    public static String[] split(String name) {
        return name.split(DELIMITER);
    }

    /**
     * 通知
     */

    public static final String NOTIFY = "YX_NOTIFY"; // 通知

    /**
     * 说吧首页的说吧
     */

    public static final String TALK_NEW = "TALK_NEW"; // 全部说吧

    public static final String TALK_REC = "TALK_REC"; // 推荐说吧

    public static final String TALK_CATEGORY_REC = "TALK_CATEGORY_REC"; // 分类推荐说吧

    public static final String TALK_CATEGORY_NEW = "TALK_CATEGORY_NEW"; // 分类最新说吧

    /**
     * 说吧首页的主贴
     */

    public static final String TALK_POST_REC = "TALK_POST_REC"; // 推荐主贴

    /**
     * 说吧主贴
     */

    public static final String TALK_POST_NEW = "TALK_POST_NEW"; // 说吧最新主贴

    public static final String TALK_POST_TOP = "TALK_POST_TOP"; // 说吧置顶主贴

    public static final String TALK_POST_PIN = "TALK_POST_PIN"; // 说吧精华主贴

    public static final String TALK_EVENT_NEW = "TALK_EVENT_NEW"; // 说吧最新事件

    public static final String TALK_POST_NEW_HIGHQUALITY = "TALK_POST_NEW_HIGH"; // 说吧最新主贴优质
    public static final String TALK_POST_NEW_NORMAL = "TALK_POST_NEW_NOR"; // 说吧最新主贴普通

    public static final String TALK_POST_NEW_FEED = "TALK_POST_NEW_FEED"; // 说吧新帖Feed流

    /**
     * 说吧个人发帖
     */
    public static final String TALK_OUTBOX = "TALK_OUTBOX"; // 个人发帖

    /**
     * 说吧帖子评论
     */
    public static final String TALK_COMMENT = "TALK_COMMENT"; // 说吧评论

    /**
     * 说吧帖子点赞
     */
    public static final String TALK_LIKE = "TALK_LIKE"; // 说吧评论

    /**
     * 说吧帖子关注
     */
    public static final String TALK_FOLLOW = "TALK_FOLLOW"; // 说吧关注

    /**
     * 说吧关注帖子融合
     */
    public static final String TALK_FOLLOW_MERGE = "TALK_FOLLOW_MERGE"; // 说吧关注融合

    /**
     * 说吧成员
     */
    public static final String TALK_MEMBER_PREV = "TALK_MEMBER_PREV"; // 说吧成员的上一个角色

    /**
     * 星币充值排行
     */
    public static final String TALK_STAR_COIN_RECHARGE = "TALK_STAR_COIN_RECHARGE";

    /**
     * 星币剩余
     */
    public static final String TALK_STAR_COIN_REMAIN = "TALK_STAR_COIN_REMAIN";

    /**
     * 星币发放时间
     */
    public static final String TALK_STAR_COIN_REMAIN_TIME = "TALK_STAR_COIN_REMAIN_TIME";

    /**
     * 说吧分类置顶
     */
    public static final String CATEGORY_POST_TOP = "CATEGORY_POST_TOP";

    /**
     * 集合
     */
    public static final Set<String> TALK_POSTS = new LinkedHashSet<>();

    public static final Set<String> ASC = new LinkedHashSet<>();

    static {
        TALK_POSTS.add(TALK_POST_NEW);
        TALK_POSTS.add(TALK_POST_TOP);
        TALK_POSTS.add(TALK_POST_PIN);
        TALK_POSTS.add(TALK_POST_NEW_HIGHQUALITY);
        TALK_POSTS.add(TALK_POST_NEW_NORMAL);
        TALK_POSTS.add(TALK_POST_NEW_FEED);

        ASC.add(TALK_COMMENT);
        ASC.add(TALK_STAR_COIN_RECHARGE);
    }

    public static int getOrderType(String name) {
        for (String asc : InboxName.ASC) {
            if (name.contains(asc)) {
                return OrderType.ASC;
            }
        }
        return OrderType.DESC;
    }
}
